package com.black.utils.commons.display;

import lombok.extern.slf4j.Slf4j;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ylx
 */
@Slf4j
public class IOPrintUtil
{
    public static List<String> print(InputStream inputStream)
        throws IOException
    {
        if (inputStream == null)
        {
            return null;
        }
        List<String> lines = new ArrayList<>();
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
        String line;
        while ((line = reader.readLine()) != null)
        {
            log.info(line);
            lines.add(line);
        }
        return lines;
    }
}
